<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui">

<ui:composition>

    <p:dialog header="Criar conta bancária" widgetVar="create_bank_account" resizable="false" showEffect="clip" hideEffect="clip" modal="true" position="top">
        <h:panelGrid id="panel_create_bank_account" columns="2" style="margin-bottom:10px">
            <h:outputLabel for="createBankAccountName" value="Nome:" />
            <h:inputText id="createBankAccountName" value="#{financesDashboardMBean.createBankAccount.name}" />

            <h:outputLabel for="createBankAccountBalance" value="Saldo:" rendered="#{logonMBean.login.loginRulesView.root}"/>
            <h:inputText id="createBankAccountBalance" value="#{financesDashboardMBean.createBankAccount.balance}" rendered="#{logonMBean.login.loginRulesView.root}"/>

            <h:outputLabel for="createBankAccountSMS" value="Qtd SMS:" rendered="#{logonMBean.login.loginRulesView.root}"/>
            <h:inputText id="createBankAccountSMS" value="#{financesDashboardMBean.createBankAccount.quantitySmsBuyed}" rendered="#{logonMBean.login.loginRulesView.root}"/>
        </h:panelGrid>
        <p:commandButton value="Confirmar" update="growl, dataTableBankAccount, panel_edit_credit, panel_create_credit" actionListener="#{financesDashboardMBean.createBankAccount}" oncomplete="create_bank_account.hide();"/>
        <p:commandButton value="Cancelar" oncomplete="create_bank_account.hide();"/>
    </p:dialog>

    <p:dialog header="Editar conta bancárias" widgetVar="edit_bank_account" resizable="false" showEffect="clip" hideEffect="clip" modal="true" position="top" width="440">
        <h:panelGrid id="panel_edit_bank_account" columns="2" style="margin-bottom:10px">
            <h:outputLabel for="updateBankAccountName" value="Nome:" />
            <h:inputText id="updateBankAccountName" value="#{financesDashboardMBean.selectedBankAccount.name}" />

            <h:outputLabel for="updateBankAccountSMS" value="Saldo SMS:" rendered="#{logonMBean.login.loginRulesView.root}"/>
            <h:inputText id="updateBankAccountSMS" value="#{financesDashboardMBean.selectedBankAccount.quantitySmsBuyed}" rendered="#{logonMBean.login.loginRulesView.root}"/>
            
            <h:outputLabel for="updateBankAccountBalance" value="Saldo Bancário:" rendered="#{logonMBean.login.loginRulesView.root}"/>
            <h:inputText id="updateBankAccountBalance" value="#{financesDashboardMBean.selectedBankAccount.balance}" rendered="#{logonMBean.login.loginRulesView.root}"/>
        </h:panelGrid>
        <br/>
        <p:commandButton value="Confirmar" update="growl, dataTableBankAccount, dataTableCredit, panel_edit_credit, panel_create_credit" actionListener="#{financesDashboardMBean.updateBankAccount}" oncomplete="edit_bank_account.hide();"/>
        <p:commandButton value="Recalcular SMS" update="growl, dataTableBankAccount" actionListener="#{financesDashboardMBean.recalculateSms}" oncomplete="edit_bank_account.hide();" rendered="#{logonMBean.login.loginRulesView.root}"/>
        <p:commandButton value="Recalcular R$" update="growl, dataTableBankAccount" actionListener="#{financesDashboardMBean.recalculateBalance}" oncomplete="edit_bank_account.hide();" rendered="#{logonMBean.login.loginRulesView.root}"/>
        <p:commandButton value="Cancelar" oncomplete="edit_bank_account.hide();"/>
    </p:dialog>

</ui:composition>
</html>